package ms;

import java.util.Scanner;

public class Main {
	static int[] prime = { 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43 };
	static long max, best;
	static long n;

	public static void findPrime(long num, int k, long sum, int limit) {
		long temp;
		if (sum > max) {
			max = sum;
			best = num;
		}
		if (sum == max && best > num)
			best = num;
		if (k >= 14)
			return;
		temp = num;
		for (int i = 1; i <= limit; i++) {
			if (temp * prime[k] > n)
				break;
			temp = temp * prime[k];
			findPrime(temp, k + 1, sum * (i + 1), i);
		}
	}

	public static void main(String[] argsStrings) {
		Scanner in = new Scanner(System.in);
		while (in.hasNext()) {
			n = in.nextLong();
			findPrime(1, 0, 1, 50);
			System.out.println(best);
		}
	}
}